package com.iv.durian.cloud.facade.support;

import com.iv.durian.cloud.LessonDetail;
import com.iv.durian.cloud.facade.LessonDetailFacade;
import com.iv.durian.cloud.service.LessonDetailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by zlw on 2018-07-01.
 */
@Slf4j
@RestController
public class LessonDetailFacadeImpl implements LessonDetailFacade {

    @Autowired
    private LessonDetailService lessonDetailService;

    @Override
    public LessonDetail getById(@PathVariable(value = "lesson_id")Integer lessonId) {
        return lessonDetailService.getById(lessonId);
    }

    @Override
    public LessonDetail getByName(@PathVariable(value = "lesson_name")String lessonName) {
        return lessonDetailService.getByName(lessonName);
    }

    @Override
    public void add(@RequestBody LessonDetail lessonDetail) {
        lessonDetailService.add(lessonDetail);
    }

    @Override
    public void removeById(@PathVariable("lesson_id")Integer lessonId) {
        lessonDetailService.removeById(lessonId);
    }

    @Override
    public int updateLessonDetail(@RequestBody LessonDetail lessonDetail) {
        return lessonDetailService.updateLessonDetail(lessonDetail);
    }

    @Override
    public int countLessonDetail(@PathVariable("lesson_id") Integer lessonId) {
        return lessonDetailService.countLessonDetail(lessonId);
    }
}
